package com.imti.mapper;

import com.imti.bean.Duty;
import com.imti.bean.pojo.Dutya;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface DutyaDao {

    /*总条数*/
    /*@Select("")*/
    public int dutyConut(Dutya dutya);

    //查全部
    public List<Dutya> selectAll(Map<String,Object> map);

    //添加
    @Insert("INSERT INTO duty (doc_id,duty_date,ampm,reg_num,desk_id)\n" +
            "VALUES(#{docId},#{dutyDate},#{ampm},#{regNum},#{deskId})")
    public int insertAll(Dutya dutya);

   /* 根据id查询值班信息*/
    @Select("SELECT d.*,dt.doc_name,dw.desk_name " +
            " FROM duty d ,doctor dt,desk_work dw " +
            " WHERE d.`doc_id`=dt.`doc_id` " +
            " AND d.desk_id= dw.`desk_id`" +
            " and d.duty_id = #{dutyId}")
    public List<Dutya> selectOne(Dutya dutyId);

    /*根据dutyId修改数据*/
    public int update(Dutya dutya);


}
